package com.hertz.appr.http;

public class Parameter implements Comparable<Parameter>{
	private String name;
	private String value;
	
	public Parameter(String name,String value){
		this.name = name;
		this.value = value;
	}
	
	public String getName() {
		return name;
	}
	
	public String getValue() {
		return value;
	}
	
	@Override
	public int hashCode() {
		int result = name.hashCode();
		result = 31 * result + value.hashCode();
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (null == obj) {
			return false;
		}
		if (this == obj) {
			return true;
		}
		if (obj instanceof Parameter) {
			Parameter that = (Parameter) obj;
			return this.name.equals(that.name) && this.value.equals(that.value);
		}
		return false;
	}

	@Override
	public String toString() {
		return "Parameter{" + "name='" + name + '\'' + ", value='" + value + "'}";
	}

	public int compareTo(Parameter o) {
		int compared;
		Parameter that = (Parameter) o;
		compared = name.compareTo(that.name);
		if (0 == compared) {
			compared = value.compareTo(that.value);
		}
		return compared;
	}

}
